home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Cursor;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.beans.PropertyChangeEvent;
- import java.beans.PropertyChangeListener;
- import java.util.EventObject;
- import javax.swing.AbstractButton;
- import javax.swing.JButton;
- import javax.swing.JSplitPane;
- import javax.swing.UIManager;
-
- public class BasicSplitPaneDivider extends Container implements PropertyChangeListener {
- protected static final int ONE_TOUCH_SIZE = 6;
- protected static final int ONE_TOUCH_OFFSET = 2;
- protected DragController dragger;
- protected BasicSplitPaneUI splitPaneUI;
- protected int dividerSize = 0;
- protected Component hiddenDivider;
- protected JSplitPane splitPane;
- protected MouseHandler mouseHandler;
- protected int orientation;
- protected JButton leftButton;
- protected JButton rightButton;
- static final Cursor horizontalCursor = Cursor.getPredefinedCursor(11);
- static final Cursor verticalCursor = Cursor.getPredefinedCursor(9);
- static final Cursor defaultCursor = Cursor.getPredefinedCursor(0);
-
- public BasicSplitPaneDivider(BasicSplitPaneUI var1) {
- ((Container)this).setLayout(new DividerLayout(this));
- this.setBasicSplitPaneUI(var1);
- this.orientation = this.splitPane.getOrientation();
- ((Component)this).setBackground(UIManager.getColor("SplitPane.background"));
- }
-
- protected JButton createLeftOneTouchButton() {
- 1 var1 = new 1(this);
- ((AbstractButton)var1).setFocusPainted(false);
- ((AbstractButton)var1).setBorderPainted(false);
- return var1;
- }
-
- protected JButton createRightOneTouchButton() {
- 2 var1 = new 2(this);
- ((AbstractButton)var1).setFocusPainted(false);
- ((AbstractButton)var1).setBorderPainted(false);
- return var1;
- }
-
- protected void dragDividerTo(int var1) {
- this.splitPaneUI.dragDividerTo(var1);
- }
-
- protected void finishDraggingTo(int var1) {
- this.splitPaneUI.finishDraggingTo(var1);
- }
-
- public BasicSplitPaneUI getBasicSplitPaneUI() {
- return this.splitPaneUI;
- }
-
- public int getDividerSize() {
- return this.dividerSize;
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(this.getDividerSize(), this.getDividerSize());
- }
-
- protected void oneTouchExpandableChanged() {
- if (this.splitPane.isOneTouchExpandable() && this.leftButton == null && this.rightButton == null) {
- this.leftButton = this.createLeftOneTouchButton();
- if (this.leftButton != null) {
- this.leftButton.addActionListener(new LeftActionListener(this));
- }
-
- this.rightButton = this.createRightOneTouchButton();
- if (this.rightButton != null) {
- this.rightButton.addActionListener(new RightActionListener(this));
- }
-
- if (this.leftButton != null && this.rightButton != null) {
- ((Container)this).add(this.leftButton);
- ((Container)this).add(this.rightButton);
- }
- }
-
- ((Container)this).invalidate();
- ((Container)this).validate();
- }
-
- public void paint(Graphics var1) {
- super.paint(var1);
- }
-
- protected void prepareForDragging() {
- this.splitPaneUI.startDragging();
- }
-
- public void propertyChange(PropertyChangeEvent var1) {
- if (((EventObject)var1).getSource() == this.splitPane) {
- if (var1.getPropertyName().equals("orientation")) {
- this.orientation = this.splitPane.getOrientation();
- ((Container)this).invalidate();
- ((Container)this).validate();
- } else if (var1.getPropertyName().equals("oneTouchExpandable")) {
- this.oneTouchExpandableChanged();
- }
- }
-
- }
-
- public void setBasicSplitPaneUI(BasicSplitPaneUI var1) {
- if (this.splitPane != null) {
- this.splitPane.removePropertyChangeListener(this);
- if (this.mouseHandler != null) {
- this.splitPane.removeMouseListener(this.mouseHandler);
- this.splitPane.removeMouseMotionListener(this.mouseHandler);
- ((Component)this).removeMouseListener(this.mouseHandler);
- ((Component)this).removeMouseMotionListener(this.mouseHandler);
- this.mouseHandler = null;
- }
- }
-
- this.splitPaneUI = var1;
- if (var1 != null) {
- this.splitPane = var1.getSplitPane();
- if (this.splitPane != null) {
- if (this.mouseHandler == null) {
- this.mouseHandler = new MouseHandler(this);
- }
-
- this.splitPane.addMouseListener(this.mouseHandler);
- this.splitPane.addMouseMotionListener(this.mouseHandler);
- ((Component)this).addMouseListener(this.mouseHandler);
- ((Component)this).addMouseMotionListener(this.mouseHandler);
- this.splitPane.addPropertyChangeListener(this);
- if (this.splitPane.isOneTouchExpandable()) {
- this.oneTouchExpandableChanged();
- }
- }
- } else {
- this.splitPane = null;
- }
-
- }
-
- public void setDividerSize(int var1) {
- this.dividerSize = var1;
- }
- }
-